<template>
    <h1>{{ msg }}</h1>
    <button @click="adddianji">点击我调用父组件方法</button>
</template>
 
<script setup lang="ts">
import { defineProps, defineEmits } from "vue"
const props = defineProps({
    msg: {
        type: String,
        default: "",
    },
});
// emit
const emit = defineEmits(["adddianji"]);
// methods
const adddianji = () => {
    emit("adddianji", "父组件方法被调用了");
};
</script>
